# -*- coding: utf-8 -*-
# @Time : 2024/2/20 10:44
# @Author : ZH
# @File : 429.py
# @Software: PyCharm
class Node(object):
    def __init__(self, val=None, children=None):
        self.val = val
        self.children = children


class Solution(object):
    def levelOrder(self, root):
        """
        :type root: Node
        :rtype: List[List[int]]
        """
        res = []

        def abc(node):
            if not node:
                return
            k = []
            for chi in node.children:
                k.append(chi.val)
            res.append(k)
            for i in node.children:
                abc(i.children)

        res.append([root.val])
        abc(root)
        return res


if __name__ == '__main__':
    pass



